package model.playable.unit;
import model.command.*;
import model.playable.*;
import model.map.Direction;
import model.mapping.*;
import model.map.GameTile;

public abstract class BasicUnit extends Unit implements Combatable
{
	int armor;
	int health;
	int maxHealth;
	int offensiveDamage;
	int defensiveDamage;
	boolean isSoldier;
	
	public GameTile getLocation()
	{
		return PlayableMapping.getPlayableMapping().getLocationOfUnit(this);
	}
	
	public void addUpkeep(int amount)
	{
		if(amount < getUpkeep())
		{
			incrementHealth(-5);
		}
	}
	
	public int getArmor()
	{
		return armor;
	}
	
	public void setArmor(int armor)
	{
		this.armor = armor;
	}
	
	public int getHealth()
	{
		return health;
	}
	
	public void setHealth(int health)
	{
		this.health = health;
	}
	
	public int getMaxHealth()
	{
		return maxHealth;
	}
	
	public void setMaxHealth(int maxHealth)
	{
		this.maxHealth = maxHealth;
	}
	
	public int getOffensiveDamage()
	{
		return offensiveDamage;
	}
	
	public void setOffensiveDamage(int offensiveDamage)
	{
		this.offensiveDamage = offensiveDamage;
	}
	
	public int getDefensiveDamage()
	{
		return defensiveDamage;
	}
	
	public void setDefensiveDamage(int defensiveDamage)
	{
		this.defensiveDamage = defensiveDamage;
	}
	
	public boolean getIsSoldier()
	{
		return isSoldier;
	}
	
	public void setIsSoldier(boolean isSoldier)
	{
		this.isSoldier = isSoldier;
	}
	
	public void incrementArmor(int increment)
	{
		armor += increment;
	}
	
	public void incrementHealth(int increment)
	{
		health += increment;
	}
	
	public void incrementOffensiveDamage(int increment)
	{
		offensiveDamage += increment;
	}
	
	public void incrementDefensiveDamage(int increment)
	{
		defensiveDamage += increment;
	}
	
	public void attack(Direction direction)
	{
		System.out.println("This unit executed attack " + direction.toString() );
	}
	
	public void defend(Direction direction)
	{
		System.out.println("This unit executed defend " + direction.toString() );
	}
	
	public void takeDamage(int i)
	{
		incrementHealth(-i);
	}
	
	public void heal(int i)
	{
		incrementHealth(i);
	}
	
	
}